﻿using System;
using YArchitech.Revit.Electric.Common;

namespace ElectricDim
{
	public class ElectricMarkFilter : IFilterFamilyObject
	{
		public ElectricMarkFilter(int category)
		{
			this.categoryValue = category;
		}

		bool IFilterFamilyObject.IsMatch(DbFamilyObject familyObject)
		{
			if (familyObject == null)
			{
				return false;
			}
			foreach (DbFamilyParameter dbFamilyParameter in familyObject.Parameters)
			{
				if (dbFamilyParameter.Value != null && "Category" == dbFamilyParameter.Name && this.categoryValue == Convert.ToInt32(dbFamilyParameter.Value))
				{
					return true;
				}
			}
			return false;
		}

		private const string categoryName = "Category";

		private int categoryValue;
	}
}
